﻿using CPPEI.Coolzon.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.WPF.Core
{
    public static class StartupAppUtil
    {
        /// <summary>
        /// 启动程序不执行更新
        /// </summary>
        /// <param name="appInfo"></param>
        public static void StartupAppNoUpdate(AppInfo appInfo)
        {
            ProcessStartInfo processStartInfo = new ProcessStartInfo();
            processStartInfo.FileName = appInfo.AppFile;
            processStartInfo.Arguments = string.Format("/{0} {1}", Coolzon.Common.Startup.StartupParam.PARAM_CHECKVERSION, false);
            processStartInfo.UseShellExecute = true;
            processStartInfo.Verb = "runas";   
            Process.Start(processStartInfo);
        }

        public static void StartupApp(AppInfo appInfo, string arguments)
        {
            ProcessStartInfo processStartInfo = new ProcessStartInfo();
            processStartInfo.FileName = appInfo.AppFile;
            processStartInfo.Arguments = arguments;
            processStartInfo.UseShellExecute = true;
            processStartInfo.Verb = "runas";  
            Process.Start(processStartInfo);
        }
    }
}
